package com.hl.card.credit.pub.entity;

import java.util.Date;
import java.util.Map;

import com.hl.card.credit.pub.model.PublicOrdersAllModel;
import com.hl.card.credit.pub.utils.CommonUtil;

/**
 * 订单时间节点
 * 
 * @author wdf
 * 
 */
public class PublicOrderTimeNode {
	/**
	 * 主键
	 */
	private Integer order_node_id;

	/**
	 * 业务类型（正常、退票、改签、交易手续费）
	 */
	private String business_type;

	/**
	 * 订单号
	 */
	private String order_code;

	/**
	 * 序号
	 */
	private String serial_number;

	/**
	 * 状态变更
	 */
	private String status_change;

	/**
	 * 操作时间
	 */
	private Date operation_time;

	/**
	 * 操作人
	 */
	private String operation_user;

	/**
	 * 详细 json
	 */
	private String detail;
	
	/**
	 * 业务编号(由业务自己定义)
	 */
	private String business_code;

	/**
	 * 
	 * @param map
	 * order_code</p>business_type</p>status_change</p>serial_number</p>operation_user</p>remark</p>business_code
	 * @return
	 */

	public static PublicOrderTimeNode init(Map<String, Object> map) {
		PublicOrderTimeNode publicOrderTimeNode = new PublicOrderTimeNode();
		if (map!=null) {
			publicOrderTimeNode.setOrder_code((String)map.get("order_code"));
			publicOrderTimeNode.setBusiness_type((String)map.get("business_type"));// 默认正常
			publicOrderTimeNode.setOperation_time(new Date());
			publicOrderTimeNode.setOperation_user((String)map.get("operation_user"));
			publicOrderTimeNode.setDetail((String)map.get("remark"));
			
			publicOrderTimeNode.setStatus_change((String)map.get("status_change"));
			publicOrderTimeNode.setSerial_number((String)map.get("serial_number"));
			publicOrderTimeNode.setBusiness_code((String)map.get("business_code"));
		}
		return publicOrderTimeNode;
	}
	/**
	 * 
	 * @Title: init
	 * @Description: TODO(PublicOrderTimeNode初始化)
	 * @param @param map
	 * @param @param allModel
	 * @param @return 参数
	 * @return PublicOrderTimeNode 返回类型
	 * @throws
	 */
	public static PublicOrderTimeNode init(Map<String, Object> map,
			PublicOrdersAllModel allModel) {
		PublicOrderTimeNode publicOrderTimeNode = new PublicOrderTimeNode();
		if(CommonUtil.isEmpty(allModel))
			return null;
		if(CommonUtil.isEmpty(allModel.getPublicOrderTimeNode()))
			return publicOrderTimeNode;
		publicOrderTimeNode.setOrder_code(allModel.getOrder_code());
		publicOrderTimeNode.setBusiness_type(allModel.getBusiness_type());// 默认正常
		if(CommonUtil.isNotEmpty(allModel.getPublicOrderTimeNode().getStatus_change()))
			publicOrderTimeNode.setStatus_change(allModel.getPublicOrderTimeNode().getStatus_change());
		if(CommonUtil.isNotEmpty(allModel.getPublicOrderTimeNode().getSerial_number()))
			publicOrderTimeNode.setSerial_number(allModel.getPublicOrderTimeNode().getSerial_number());
		if(CommonUtil.isNotEmpty(allModel.getPublicOrderTimeNode().getOperation_time()))
			publicOrderTimeNode.setOperation_time(allModel.getPublicOrderTimeNode().getOperation_time());
		else
			publicOrderTimeNode.setOperation_time(new Date());
		
		if(CommonUtil.isNotEmpty(allModel.getPublicOrderTimeNode().getOperation_user()))
			publicOrderTimeNode.setOperation_user(allModel.getOperation_user());
		if(CommonUtil.isNotEmpty(allModel.getPublicOrderTimeNode().getDetail()))
			publicOrderTimeNode.setDetail(allModel.getPublicOrderTimeNode().getDetail());
		if(CommonUtil.isNotEmpty(allModel.getPublicOrderTimeNode().getBusiness_code()))
			publicOrderTimeNode.setBusiness_code(allModel.getPublicOrderTimeNode().getBusiness_code());
		return publicOrderTimeNode;
	}

	
	
	/**
	 * @return business_code
	 */
	
	public String getBusiness_code() {
		return business_code;
	}



	/**
	 * @param paramtheparamthe{bare_field_name} to set
	 */
	
	public void setBusiness_code(String business_code) {
		this.business_code = business_code;
	}



	public void setOrder_node_id(Integer order_node_id) {
		this.order_node_id = order_node_id;
	}

	public Integer getOrder_node_id() {
		return this.order_node_id;
	}

	public void setBusiness_type(String business_type) {
		this.business_type = business_type;
	}

	public String getBusiness_type() {
		return this.business_type;
	}

	public void setOrder_code(String order_code) {
		this.order_code = order_code;
	}

	public String getOrder_code() {
		return this.order_code;
	}

	public void setSerial_number(String serial_number) {
		this.serial_number = serial_number;
	}

	public String getSerial_number() {
		return this.serial_number;
	}

	public void setStatus_change(String status_change) {
		this.status_change = status_change;
	}

	public String getStatus_change() {
		return this.status_change;
	}

	public void setOperation_time(Date operation_time) {
		this.operation_time = operation_time;
	}

	public Date getOperation_time() {
		return this.operation_time;
	}

	public void setOperation_user(String operation_user) {
		this.operation_user = operation_user;
	}

	public String getOperation_user() {
		return this.operation_user;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public String getDetail() {
		return this.detail;
	}

}
